package com.bw.realtime_common.util;

import com.bw.realtime_common.constant.Constant;

/**
 * @BelongsProject: gmall_lx
 * @BelongsPackage: com.bw.realtime_common.util
 * @Author: cuizexuan
 * @CreateTime: 2025-06-23  10:56
 * @Description: TODO
 * @Version: 1.0
 */
public class SQLUtil123 {
    public static String getKafkaDDLSource(String groupId, String topic) {
        return "with(" +
                "  'connector' = 'kafka'," +
                "  'properties.group.id' = '" + groupId + "'," +
                "  'topic' = '" + topic + "'," +
                "  'properties.bootstrap.servers' = '" + Constant.KAFKA_BROKERS + "'," +
                "  'scan.startup.mode' = 'earliest-offset'," +
                "  'json.ignore-parse-errors' = 'true'," + // 当 json 解析失败的时候,忽略这条数据
                "  'format' = 'json' " +
                ")";
    }

    public static String getKafkaDDLSink(String topic) {
        return "with(" +
                "  'connector' = 'kafka'," +
                "  'topic' = '" + topic + "'," +
                "  'properties.bootstrap.servers' = '" + Constant.KAFKA_BROKERS + "'," +
                "  'format' = 'json' " +
                ")";
    }
}
